
//对象 Object
const person = {
    firstName: "simon",
    lastName: "young",
    age: 36,
}

//console.log(person.nickName); //报错：提示键不存在，但当person定义成any类型，就不会报错了

//可以显式定义成object，但写不写都是object类型，所以实际应用中，可以不写
const person2: object = {
    firstName: "simon",
    lastName: "young",
    age: 36,
}

//也可以显式指定object中的每个键的类型
const person3: {
    firstName: string,
    lastName: string,
    age: number
} = {
    firstName: "simon",
    lastName: "young",
    age: 36,
}

console.log(person.firstName);